function getList() {
	$("#dataTables-example").dataTable().fnDestroy();
	$.ajax({
		url: "https://order.wz1996.wang/wzbg/banner/all",
		type: 'get',
		contentType: 'application/json',
		beforeSend: function(request) {
			request.setRequestHeader("token", localStorage.getItem("token"));
		},
		success: function(data) {
			console.log(data);
			if(data.code == "1") {
				var html = "";
				for(var i = 0; i < data.data.length; i++) {
					html += "<tr class='odd gradeX'>";
					html += "<td><div class='bannerDiv'><img src='" + data.data[i].banner.imageUrl + "'></div></td>";
					html += "<td>" + data.data[i].banner.name + "</td>";
					html += "<td>" + data.data[i].banner.onDaytime + "</td>";
					html += "<td>" + data.data[i].banner.offDaytime + "</td>";
					html += "<td>";
					if(data.data[i].openedCities != "" || data.data[i].openedCities != null || data.data[i].openedCities != undefined) {
						for(var j = 0; j < data.data[i].openedCities.length; j++) {
							if(data.data[i].openedCities.length > 0) {
								html += "<span style='margin-right:5px'>" + data.data[i].openedCities[j].cityName + "</span>";
							} else {
								html += "<span>--</span>";
							}
						}
					} else {
						html += "<span>--</span>";
					}
					html += "</td>";
					if(data.data[i].banner.type == "0") {
						html += "<td>商品</td>";
					} else {
						html += "<td>网页</td>";
					}
					if(data.data[i].banner.sort == null || data.data[i].banner.sort == "" || data.data[i].banner.sort == undefined) {
						html += "<td>--</td>";
					} else {
						html += "<td>" + data.data[i].banner.sort + "</td>";
					}
					html += "<td><a id=" + data.data[i].banner.id + " href='../update-banner/update-banner.html' class='updateBanner'>修改</a><a id=" + data.data[i].banner.id + " href='javascript:void(0);' style='margin-left:5px' class='deltel'>删除</a></td>";
					html += "</tr>";
				}
				$("#list-td").html(html);
				$('#dataTables-example').DataTable({
					responsive: false,
					bLengthChange: false,
					bSort: true,
					paging: true,
					bFilter: true,
					searching: false,
					bInfo: true,
					bAutoWidth: true,
					"oLanguage": {
						"sLengthMenu": "每页显示 _MENU_ 条记录",
						"sZeroRecords": "抱歉， 没有找到",
						"sInfo": "从 _START_ 到 _END_ /共 _TOTAL_ 条数据",
						"sInfoEmpty": "没有数据",
						"sInfoFiltered": "(从 _MAX_ 条数据中检索)",
						"oPaginate": {
							"sFirst": "首页",
							"sPrevious": "前一页",
							"sNext": "后一页",
							"sLast": "尾页"
						},
						"sSearch": "查询条件:",
						"sZeroRecords": "没有检索到数据",
						"sProcessing": "<img src='./loading.gif' />"
					}
				});
			} else if(data.code == "-1") {
				layar(data.msg);
				setTimeout("window.parent.frames.location.href='/xcxadmin/login.html'", 1000)
			} else {
				layar(data.msg);
			}

		},
		error: function(e) {
			errcode(e);
		}
	});
}
$("#dataTables-example").on('click', '.deltel', function() {
	var deiId = $(this).attr("id");
	layer.confirm('您确定删除吗？', {
		btn: ['确定', '取消'], //按钮
		offset: '25%'
	}, function(index) {
		$.ajax({
			url: "https://order.wz1996.wang/wzbg/banner/remove/" + deiId,
			type: 'DELETE',
			contentType: 'application/json',
			beforeSend: function(request) {
				request.setRequestHeader("token", localStorage.getItem("token"));
			},
			success: function(data) {
				console.log(data);
				//登录状态
				if(data.code == "1") {
					layar("删除成功");
					getList();
				} else if(data.code == "-1") {
					layar(data.msg);
					setTimeout("window.parent.frames.location.href='/xcxadmin/login.html'", 1000)
				} else {
					layar(data.msg);
				}
			},
			error: function(e) {
				errcode(e);
			}
		});
	});
});
$(".cancel").on('click', function() {
	$(".delbox").hide();
	$(".bgc").hide();
});
$("#dataTables-example").on('click', '.updateBanner', function() {
	var updateId = $(this).attr("id");
	localStorage.setItem("updateId", updateId);
});